package com.example.chapter02;

import android.graphics.Color;
import android.os.Bundle;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import androidx.appcompat.app.AppCompatActivity;

import com.example.chapter02.utils.Utils;

public class TextViewActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_text_view);
        TextView tv_hello = findViewById(R.id.tv_hello);
        tv_hello.setText(R.string.hello_world);
        //tv_hello.setTextSize(50);

        TextView tv3_hello = findViewById(R.id.tv_hello3);
        tv3_hello.setTextColor(Color.RED);

        ViewGroup.LayoutParams layoutParams = tv3_hello.getLayoutParams();
        layoutParams.width = Utils.dip2px(this, 300);
        tv3_hello.setLayoutParams(layoutParams);
    }
}
